package com.webshopping.tag;

import java.util.List;

import com.webshopping.entry.AttributeMetadata;
import com.webshopping.entry.Dict;
import com.webshopping.service.dict.DictService;



public class SelectTag extends AbastractTag {

	@Override
	public String genetateTag(AttributeMetadata attrMd) {
		System.out.println(attrMd);
		StringBuffer sb = new StringBuffer();
		sb.append(attrMd.getAttText()+"&nbsp;").append("<select name=\"").append(attrMd.getAttribute()).append("\">");
		List<Dict> dictData = DictService.getDictByType(attrMd.getDictType());
		System.out.println(dictData);
		for(Dict dict:dictData){
			sb.append("<option value=\"").append(dict.getDictValue()).append("\">");
			sb.append(dict.getDictText());
			sb.append("</option>");
		}
		sb.append("</select>");
		return sb.toString();
	}

}
